home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/perl
- # ts, boone, 07/27/92
- # Search for keywords in Gopher user-visible filenames
- # Copyright (C) 1992, Trustees of Michigan State University
- #
- # Modifications:
- # 07/27/92 Boone Initial coding
- # 09/10/92 Boone Ts was losing some items due to identical paths.
- # These were mostly root directory items and telnet
- # sessions. The way ts build the associative array
- # index now includes both the user string and the
- # selector. Ts now searches just the user visible
- # title field.
- # End Modifications
- #
- # Version 1.2
- #
- # Description:
- #
- # Ts searches for a keyword in an index file containing a complete
- # Gopher-style directory of a file tree. The index can be created with
- # the tb program. The search is caseless.
- #
- # Comments and bug reports to boone@convex.cl.msu.edu.
- # Feedback on how useful the sort really is would be appreciated. Note
- # however that it consumes fairly few cycles compared to the search itself.
- # End Description
-
- open(TSLOG, ">>.ts/.tslog");
- chop($d = `date`);
- open(DB, ".ts/.tsdata") || die;
- $words = join("|", split(/ /, $ARGV[0]));
- @plist = grep(/^[^\t]*($words)[^\t]*\t/i, <DB>);
- sort(@plist);
- foreach $i (@plist)
- {
- print stdout $i;
- }
- print stdout ".\n";
- close(TSLOG);
- close(DB);
-